def find(s1,s2):
    if not s1 or len(s1)<=0 \
        or not s2 or len(s2)<=0 :
        return -1
    if len(s1)<len(s2) :
        ss = s1
        s1 = s2
        s2 = ss
    i = 0
    while i+len(s2)<=len(s1):
        j = 0
        while j<len(s2) and s2[j]==s1[i+j] :
            j+=1
        if j>=len(s2) :
            break
        i+=1
    return i if i+len(s2)<=len(s1) else -1

def getNxt(s):
    ls,j=len(s),0
    nxt=[0]*(ls+1)
    # for i in xrange(1,ls):
    for i in range(1, ls):
        while j>0 and s[i]!=s[j]:
            j=nxt[j]
        if s[i]==s[j]:
            j+=1
        nxt[i+1]=j
    return nxt

def KMP(s,m):
    l1,l2,j=len(s),len(m),0
    nxt,res=getNxt(m),[]
    # for i in xrange(l1):
    for i in range(l1):
        while j>0 and s[i]!=m[j]:
            j=nxt[j]
        if s[i]==m[j]:
            j+=1
        if j>=l2:
            res.append(i-j+1)
            # return True
            j=nxt[j]
    return res
    # return False

def main():
    # s1 = raw_input()
    s1 = input()
    # s2 = raw_input()
    s2 = input()
    p = find(s1,s2) if len(s1)>=len(s2) else find(s2,s1)
    if p>-1 :
        # print 'Yes'
        print('Yes')
    else :
        # print 'No'
        print('No')
    # print KMP(s1,s2) if len(s1)>=len(s2) else KMP(s2,s1)
    p = KMP(s1,s2) if len(s1)>=len(s2) else KMP(s2,s1)
    if len(p)>0:
        # print 'Yes'
        print('Yes')
    else :
        # print 'No'
        print('No')

if __name__ == '__main__' :
    main()
